package com.hsjk.szwj.module.pay.mq.delayed;

import com.hsjk.szwj.framework.mq.core.RedisMQTemplate;
import com.hsjk.szwj.framework.mq.core.listener.RedisDelayedQueueListener;
import com.hsjk.szwj.module.pay.dal.dataobject.config.PayOrderMchNotifyMQ;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author chenjiawei
 * @desc 订单通知延迟队列监听
 * @Date 2023/09/04 11:10
 **/
@Component
@Slf4j
public class PayOrderMchNotifyListener
        implements RedisDelayedQueueListener<PayOrderMchNotifyMQ> {
    @Resource
    private RedisMQTemplate redisMQTemplate;

    @Override
    public void invoke(PayOrderMchNotifyMQ mchNotifyMQ) {
        log.info("订单通知延迟队列监听:{}",mchNotifyMQ);
        redisMQTemplate.send(PayOrderMchNotifyMQ
                .build(mchNotifyMQ.getPayload().getNotifyId(),
                        mchNotifyMQ.getPayload().getTenantId()));
    }
}
